package com.zjw.forum.model;

import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonInclude;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import java.util.Date;
@Data
@ApiModel("返回user信息")
public class User {
    private Long id;
    @ApiModelProperty("用户名")
    private String username;
    @JsonIgnore//禁止该属性进行json序列号
    @ApiModelProperty("密码")
    private String password;
    @ApiModelProperty("名字")
    private String nickname;
    @ApiModelProperty("电话号码")
    private String phoneNum;
    @ApiModelProperty("邮箱")
    private String email;
    @ApiModelProperty("性别")
    private Byte gender;
    @JsonInclude(JsonInclude.Include.ALWAYS)//必须序列化
    @ApiModelProperty("头像地址")
    private String avatarUrl;
    @ApiModelProperty("文章数目")
    private Integer articleCount;
    @ApiModelProperty("是否为管理员")
    private Byte isAdmin;
    @ApiModelProperty("个人简介")
    private String remark;

    private Byte state;
    @JsonIgnore//禁止该属性进行json序列号
    @ApiModelProperty("是否被删除")
    private Byte deleteState;
    @ApiModelProperty("注册时间")
    private Date createTime;

    private Date updateTime;

    // 使用 @JsonFormat 注解处理日期字段
//    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
//    public Date getCreateTime() {
//        return createTime;
//    }
//
//    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
//    public Date getUpdateTime() {
//        return updateTime;
//    }

//    public String getCreateTime() {
//        return DateUtil.format(createTime);
//    }
//
//    public String getUpdateTime() {
//        return DateUtil.format(createTime);
//    }
}